package pe.edu.upc.jtigers.svpn.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import pe.edu.upc.jtigers.svpn.aplication.bean.ControlBean;
import pe.edu.upc.jtigers.svpn.domain.model.Control;
import pe.edu.upc.jtigers.svpn.domain.service.ControlService;
import pe.edu.upc.jtigers.svpn.web.common.BaseController;
import pe.edu.upc.jtigers.svpn.web.common.RequestMappingConstant;

@Controller
public class ControlController extends BaseController {
	@Autowired
	private ControlService controlService;

	@RequestMapping(RequestMappingConstant.REGISTRAR_CONTROL)
	@ResponseBody
	public Control listaPlan(@RequestBody ControlBean control) {
		control.setIdUsuario(
				this.getUsuarioLogueado().getIdUsuario());
		Control respuesta = controlService.registrarControl(control);
		return respuesta;
	}

}
